using System;
using System.ComponentModel;
using System.ServiceModel;
using System.Threading;
using FU.Capstones.IMS.Web.Common.InventoryServiceProxy.DataContracts;
using FU.Capstones.IMS.Web.Common.InventoryServiceProxy.EventArgs;
using FU.Capstones.IMS.Web.Common.InventoryServiceProxy.Interfaces;
using FU.Capstones.IMS.Web.Common.InventoryServiceProxy.Respondents;

namespace FU.Capstones.IMS.Web.Common.InventoryServiceProxy.OperationContracts
{
    public partial class InventoryServiceClient
    {

        //#region GetAccountCollection

        //public event EventHandler<CollectionFeedbackCompletedEventArgs<Account>> GetAccountCollectionCompleted;

        //[EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        //IAsyncResult IInventoryService.BeginGetAccountCollection(bool isShowAll, AsyncCallback callback, object asyncState)
        //{
        //    return Channel.BeginGetAccountCollection(isShowAll, callback, asyncState);
        //}

        //[EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        //CollectionFeedback<Account> IInventoryService.EndGetAccountCollection(IAsyncResult result)
        //{
        //    return Channel.EndGetAccountCollection(result);
        //}

        //private IAsyncResult OnBeginGetAccountCollection(object[] inValues, AsyncCallback callback, object asyncState)
        //{
        //    bool isShowAll = (bool)inValues[0];

        //    return ((IInventoryService)(this)).BeginGetAccountCollection(isShowAll, callback, asyncState);
        //}

        //private object[] OnEndGetAccountCollection(IAsyncResult result)
        //{
        //    CollectionFeedback<Account> retVal = ((IInventoryService)(this)).EndGetAccountCollection(result);
        //    return new object[] { retVal };
        //}

        //private void OnGetAccountCollectionCompleted(object state)
        //{
        //    if ((GetAccountCollectionCompleted != null))
        //    {
        //        InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
        //        GetAccountCollectionCompleted(this, new CollectionFeedbackCompletedEventArgs<Account>(e.Results, e.Error, e.Cancelled, e.UserState));
        //    }
        //}

        //public void GetAccountCollectionAsync(bool isShowAll)
        //{
        //    GetAccountCollectionAsync(isShowAll, null);
        //}

        //public void GetAccountCollectionAsync(bool isShowAll, object userState)
        //{
        //    if ((onBeginGetAccountCollectionDelegate == null))
        //    {
        //        onBeginGetAccountCollectionDelegate = new BeginOperationDelegate(OnBeginGetAccountCollection);
        //    }
        //    if ((onEndGetAccountCollectionDelegate == null))
        //    {
        //        onEndGetAccountCollectionDelegate = new EndOperationDelegate(OnEndGetAccountCollection);
        //    }
        //    if ((onGetAccountCollectionCompletedDelegate == null))
        //    {
        //        onGetAccountCollectionCompletedDelegate = new SendOrPostCallback(OnGetAccountCollectionCompleted);
        //    }
        //    InvokeAsync(onBeginGetAccountCollectionDelegate, new object[] {
        //            isShowAll}, onEndGetAccountCollectionDelegate, onGetAccountCollectionCompletedDelegate, userState);
        //}

        //private BeginOperationDelegate onBeginGetAccountCollectionDelegate;

        //private EndOperationDelegate onEndGetAccountCollectionDelegate;

        //private SendOrPostCallback onGetAccountCollectionCompletedDelegate;

        //private partial class InventoryServiceClientChannel
        //{
        //    public IAsyncResult BeginGetAccountCollection(bool isShowAll, AsyncCallback callback, object asyncState)
        //    {
        //        object[] _args = new object[1];
        //        _args[0] = isShowAll;

        //        IAsyncResult _result = BeginInvoke("GetAccountCollection", _args, callback, asyncState);
        //        return _result;
        //    }

        //    public CollectionFeedback<Account> EndGetAccountCollection(IAsyncResult result)
        //    {
        //        object[] _args = new object[0];
        //        CollectionFeedback<Account> _result = ((CollectionFeedback<Account>)(EndInvoke("GetAccountCollection", _args, result)));
        //        return _result;
        //    }
        //}

        //#endregion

        //#region GetSingleAccount

        //public event EventHandler<SingleFeedbackCompletedEventArgs<Account>> GetSingleAccountCompleted;

        //[EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        //IAsyncResult IInventoryService.BeginGetSingleAccount(int accountID, AsyncCallback callback, object asyncState)
        //{
        //    return Channel.BeginGetSingleAccount(accountID, callback, asyncState);
        //}

        //[EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        //SingleFeedback<Account> IInventoryService.EndGetSingleAccount(IAsyncResult result)
        //{
        //    return Channel.EndGetSingleAccount(result);
        //}

        //private IAsyncResult OnBeginGetSingleAccount(object[] inValues, AsyncCallback callback, object asyncState)
        //{
        //    int accountID = (int)inValues[0];

        //    return ((IInventoryService)(this)).BeginGetSingleAccount(accountID, callback, asyncState);
        //}

        //private object[] OnEndGetSingleAccount(IAsyncResult result)
        //{
        //    SingleFeedback<Account> retVal = ((IInventoryService)(this)).EndGetSingleAccount(result);
        //    return new object[] { retVal };
        //}

        //private void OnGetSingleAccountCompleted(object state)
        //{
        //    if ((GetSingleAccountCompleted != null))
        //    {
        //        InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
        //        GetSingleAccountCompleted(this, new SingleFeedbackCompletedEventArgs<Account>(e.Results, e.Error, e.Cancelled, e.UserState));
        //    }
        //}

        //public void GetSingleAccountAsync(int accountID)
        //{
        //    GetSingleAccountAsync(accountID, null);
        //}

        //public void GetSingleAccountAsync(int accountID, object userState)
        //{
        //    if ((onBeginGetSingleAccountDelegate == null))
        //    {
        //        onBeginGetSingleAccountDelegate = new BeginOperationDelegate(OnBeginGetSingleAccount);
        //    }
        //    if ((onEndGetSingleAccountDelegate == null))
        //    {
        //        onEndGetSingleAccountDelegate = new EndOperationDelegate(OnEndGetSingleAccount);
        //    }
        //    if ((onGetSingleAccountCompletedDelegate == null))
        //    {
        //        onGetSingleAccountCompletedDelegate = new SendOrPostCallback(OnGetSingleAccountCompleted);
        //    }
        //    InvokeAsync(onBeginGetSingleAccountDelegate, new object[] {
        //                                                                  accountID}, onEndGetSingleAccountDelegate, onGetSingleAccountCompletedDelegate, userState);
        //}

        //private BeginOperationDelegate onBeginGetSingleAccountDelegate;

        //private EndOperationDelegate onEndGetSingleAccountDelegate;

        //private SendOrPostCallback onGetSingleAccountCompletedDelegate;

        //private partial class InventoryServiceClientChannel
        //{
        //    public IAsyncResult BeginGetSingleAccount(int accountID, AsyncCallback callback, object asyncState)
        //    {
        //        object[] _args = new object[1];
        //        _args[0] = accountID;

        //        IAsyncResult _result = BeginInvoke("GetSingleAccount", _args, callback, asyncState);
        //        return _result;
        //    }

        //    public SingleFeedback<Account> EndGetSingleAccount(IAsyncResult result)
        //    {
        //        object[] _args = new object[0];
        //        SingleFeedback<Account> _result = ((SingleFeedback<Account>)(EndInvoke("GetSingleAccount", _args, result)));
        //        return _result;
        //    }
        //}

        //#endregion

        //#region InsertAccount

        //public event EventHandler<SingleFeedbackCompletedEventArgs<int>> InsertAccountCompleted;

        //[EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        //IAsyncResult IInventoryService.BeginInsertAccount(Account data, AsyncCallback callback, object asyncState)
        //{
        //    return Channel.BeginInsertAccount(data, callback, asyncState);
        //}

        //[EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        //SingleFeedback<int> IInventoryService.EndInsertAccount(IAsyncResult result)
        //{
        //    return Channel.EndInsertAccount(result);
        //}

        //private IAsyncResult OnBeginInsertAccount(object[] inValues, AsyncCallback callback, object asyncState)
        //{
        //    Account data = (Account)inValues[0];

        //    return ((IInventoryService)(this)).BeginInsertAccount(data, callback, asyncState);
        //}

        //private object[] OnEndInsertAccount(IAsyncResult result)
        //{
        //    SingleFeedback<int> retVal = ((IInventoryService)(this)).EndInsertAccount(result);
        //    return new object[] { retVal };
        //}

        //private void OnInsertAccountCompleted(object state)
        //{
        //    if ((InsertAccountCompleted != null))
        //    {
        //        InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
        //        InsertAccountCompleted(this, new SingleFeedbackCompletedEventArgs<int>(e.Results, e.Error, e.Cancelled, e.UserState));
        //    }
        //}

        //public void InsertAccountAsync(Account data)
        //{
        //    InsertAccountAsync(data, null);
        //}

        //public void InsertAccountAsync(Account data, object userState)
        //{
        //    if ((onBeginInsertAccountDelegate == null))
        //    {
        //        onBeginInsertAccountDelegate = new BeginOperationDelegate(OnBeginInsertAccount);
        //    }
        //    if ((onEndInsertAccountDelegate == null))
        //    {
        //        onEndInsertAccountDelegate = new EndOperationDelegate(OnEndInsertAccount);
        //    }
        //    if ((onInsertAccountCompletedDelegate == null))
        //    {
        //        onInsertAccountCompletedDelegate = new SendOrPostCallback(OnInsertAccountCompleted);
        //    }
        //    InvokeAsync(onBeginInsertAccountDelegate, new object[] {
        //                                                               data}, onEndInsertAccountDelegate, onInsertAccountCompletedDelegate, userState);
        //}

        //private BeginOperationDelegate onBeginInsertAccountDelegate;

        //private EndOperationDelegate onEndInsertAccountDelegate;

        //private SendOrPostCallback onInsertAccountCompletedDelegate;

        //private partial class InventoryServiceClientChannel
        //{
        //    public IAsyncResult BeginInsertAccount(Account data, AsyncCallback callback, object asyncState)
        //    {
        //        object[] _args = new object[1];
        //        _args[0] = data;

        //        IAsyncResult _result = BeginInvoke("InsertAccount", _args, callback, asyncState);
        //        return _result;
        //    }

        //    public SingleFeedback<int> EndInsertAccount(IAsyncResult result)
        //    {
        //        object[] _args = new object[0];
        //        SingleFeedback<int> _result = ((SingleFeedback<int>)(EndInvoke("InsertAccount", _args, result)));
        //        return _result;
        //    }
        //}

        //#endregion

        //#region UpdateAccount

        //public event EventHandler<FeedbackCompletedEventArgs> UpdateAccountCompleted;

        //[EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        //IAsyncResult IInventoryService.BeginUpdateAccount(Account data, AsyncCallback callback, object asyncState)
        //{
        //    return Channel.BeginUpdateAccount(data, callback, asyncState);
        //}

        //[EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        //Feedback IInventoryService.EndUpdateAccount(IAsyncResult result)
        //{
        //    return Channel.EndUpdateAccount(result);
        //}

        //private IAsyncResult OnBeginUpdateAccount(object[] inValues, AsyncCallback callback, object asyncState)
        //{
        //    Account data = (Account)inValues[0];

        //    return ((IInventoryService)(this)).BeginUpdateAccount(data, callback, asyncState);
        //}

        //private object[] OnEndUpdateAccount(IAsyncResult result)
        //{
        //    Feedback retVal = ((IInventoryService)(this)).EndUpdateAccount(result);
        //    return new object[] { retVal };
        //}

        //private void OnUpdateAccountCompleted(object state)
        //{
        //    if ((UpdateAccountCompleted != null))
        //    {
        //        InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
        //        UpdateAccountCompleted(this, new FeedbackCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
        //    }
        //}

        //public void UpdateAccountAsync(Account data)
        //{
        //    UpdateAccountAsync(data, null);
        //}

        //public void UpdateAccountAsync(Account data, object userState)
        //{
        //    if ((onBeginUpdateAccountDelegate == null))
        //    {
        //        onBeginUpdateAccountDelegate = new BeginOperationDelegate(OnBeginUpdateAccount);
        //    }
        //    if ((onEndUpdateAccountDelegate == null))
        //    {
        //        onEndUpdateAccountDelegate = new EndOperationDelegate(OnEndUpdateAccount);
        //    }
        //    if ((onUpdateAccountCompletedDelegate == null))
        //    {
        //        onUpdateAccountCompletedDelegate = new SendOrPostCallback(OnUpdateAccountCompleted);
        //    }
        //    InvokeAsync(onBeginUpdateAccountDelegate, new object[] {
        //                                                               data}, onEndUpdateAccountDelegate, onUpdateAccountCompletedDelegate, userState);
        //}

        //private BeginOperationDelegate onBeginUpdateAccountDelegate;

        //private EndOperationDelegate onEndUpdateAccountDelegate;

        //private SendOrPostCallback onUpdateAccountCompletedDelegate;

        //private partial class InventoryServiceClientChannel
        //{
        //    public IAsyncResult BeginUpdateAccount(Account data, AsyncCallback callback, object asyncState)
        //    {
        //        object[] _args = new object[1];
        //        _args[0] = data;

        //        IAsyncResult _result = BeginInvoke("UpdateAccount", _args, callback, asyncState);
        //        return _result;
        //    }

        //    public Feedback EndUpdateAccount(IAsyncResult result)
        //    {
        //        object[] _args = new object[0];
        //        Feedback _result = ((Feedback)(EndInvoke("UpdateAccount", _args, result)));
        //        return _result;
        //    }
        //}

        //#endregion

        //#region DeleteAccount

        //public event EventHandler<FeedbackCompletedEventArgs> DeleteAccountCompleted;

        //[EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        //IAsyncResult IInventoryService.BeginDeleteAccount(int data, AsyncCallback callback, object asyncState)
        //{
        //    return Channel.BeginDeleteAccount(data, callback, asyncState);
        //}

        //[EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        //Feedback IInventoryService.EndDeleteAccount(IAsyncResult result)
        //{
        //    return Channel.EndDeleteAccount(result);
        //}

        //private IAsyncResult OnBeginDeleteAccount(object[] inValues, AsyncCallback callback, object asyncState)
        //{
        //    int data = (int)inValues[0];

        //    return ((IInventoryService)(this)).BeginDeleteAccount(data, callback, asyncState);
        //}

        //private object[] OnEndDeleteAccount(IAsyncResult result)
        //{
        //    Feedback retVal = ((IInventoryService)(this)).EndDeleteAccount(result);
        //    return new object[] { retVal };
        //}

        //private void OnDeleteAccountCompleted(object state)
        //{
        //    if ((DeleteAccountCompleted != null))
        //    {
        //        InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
        //        DeleteAccountCompleted(this, new FeedbackCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
        //    }
        //}

        //public void DeleteAccountAsync(int objID)
        //{
        //    DeleteAccountAsync(objID, null);
        //}

        //public void DeleteAccountAsync(int data, object userState)
        //{
        //    if ((onBeginDeleteAccountDelegate == null))
        //    {
        //        onBeginDeleteAccountDelegate = new BeginOperationDelegate(OnBeginDeleteAccount);
        //    }
        //    if ((onEndDeleteAccountDelegate == null))
        //    {
        //        onEndDeleteAccountDelegate = new EndOperationDelegate(OnEndDeleteAccount);
        //    }
        //    if ((onDeleteAccountCompletedDelegate == null))
        //    {
        //        onDeleteAccountCompletedDelegate = new SendOrPostCallback(OnDeleteAccountCompleted);
        //    }
        //    InvokeAsync(onBeginDeleteAccountDelegate, new object[] {
        //                                                               data}, onEndDeleteAccountDelegate, onDeleteAccountCompletedDelegate, userState);
        //}

        //private BeginOperationDelegate onBeginDeleteAccountDelegate;

        //private EndOperationDelegate onEndDeleteAccountDelegate;

        //private SendOrPostCallback onDeleteAccountCompletedDelegate;

        //private partial class InventoryServiceClientChannel
        //{
        //    public IAsyncResult BeginDeleteAccount(int data, AsyncCallback callback, object asyncState)
        //    {
        //        object[] _args = new object[1];
        //        _args[0] = data;

        //        IAsyncResult _result = BeginInvoke("DeleteAccount", _args, callback, asyncState);
        //        return _result;
        //    }

        //    public Feedback EndDeleteAccount(IAsyncResult result)
        //    {
        //        object[] _args = new object[0];
        //        Feedback _result = ((Feedback)(EndInvoke("DeleteAccount", _args, result)));
        //        return _result;
        //    }
        //}

        //#endregion

        //#region SearchAccount

        //public event EventHandler<CollectionFeedbackCompletedEventArgs<Account>> SearchAccountCompleted;

        //[EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        //IAsyncResult IInventoryService.BeginSearchAccount(Account criteria, AsyncCallback callback, object asyncState)
        //{
        //    return Channel.BeginSearchAccount(criteria, callback, asyncState);
        //}

        //[EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        //CollectionFeedback<Account> IInventoryService.EndSearchAccount(IAsyncResult result)
        //{
        //    return Channel.EndSearchAccount(result);
        //}

        //private IAsyncResult OnBeginSearchAccount(object[] inValues, AsyncCallback callback, object asyncState)
        //{
        //    Account criteria = (Account)inValues[0];

        //    return ((IInventoryService)(this)).BeginSearchAccount(criteria, callback, asyncState);
        //}

        //private object[] OnEndSearchAccount(IAsyncResult result)
        //{
        //    CollectionFeedback<Account> retVal = ((IInventoryService)(this)).EndSearchAccount(result);
        //    return new object[] { retVal };
        //}

        //private void OnSearchAccountCompleted(object state)
        //{
        //    if ((SearchAccountCompleted != null))
        //    {
        //        InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
        //        SearchAccountCompleted(this, new CollectionFeedbackCompletedEventArgs<Account>(e.Results, e.Error, e.Cancelled, e.UserState));
        //    }
        //}

        //public void SearchAccountAsync(Account criteria)
        //{
        //    SearchAccountAsync(criteria, null);
        //}

        //public void SearchAccountAsync(Account criteria, object userState)
        //{
        //    if ((onBeginSearchAccountDelegate == null))
        //    {
        //        onBeginSearchAccountDelegate = new BeginOperationDelegate(OnBeginSearchAccount);
        //    }
        //    if ((onEndSearchAccountDelegate == null))
        //    {
        //        onEndSearchAccountDelegate = new EndOperationDelegate(OnEndSearchAccount);
        //    }
        //    if ((onSearchAccountCompletedDelegate == null))
        //    {
        //        onSearchAccountCompletedDelegate = new SendOrPostCallback(OnSearchAccountCompleted);
        //    }
        //    InvokeAsync(onBeginSearchAccountDelegate, new object[] {
        //                                                               criteria}, onEndSearchAccountDelegate, onSearchAccountCompletedDelegate, userState);
        //}

        //private BeginOperationDelegate onBeginSearchAccountDelegate;

        //private EndOperationDelegate onEndSearchAccountDelegate;

        //private SendOrPostCallback onSearchAccountCompletedDelegate;

        //private partial class InventoryServiceClientChannel
        //{
        //    public IAsyncResult BeginSearchAccount(Account criteria, AsyncCallback callback, object asyncState)
        //    {
        //        object[] _args = new object[1];
        //        _args[0] = criteria;

        //        IAsyncResult _result = BeginInvoke("SearchAccount", _args, callback, asyncState);
        //        return _result;
        //    }

        //    public CollectionFeedback<Account> EndSearchAccount(IAsyncResult result)
        //    {
        //        object[] _args = new object[0];
        //        CollectionFeedback<Account> _result = ((CollectionFeedback<Account>)(EndInvoke("SearchAccount", _args, result)));
        //        return _result;
        //    }
        //}

        //#endregion

        //#region UndoDeleteAccount

        //public event EventHandler<FeedbackCompletedEventArgs> UndoDeleteAccountCompleted;

        //[EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        //IAsyncResult IInventoryService.BeginUndoDeleteAccount(int objID, AsyncCallback callback, object asyncState)
        //{
        //    return Channel.BeginUndoDeleteAccount(objID, callback, asyncState);
        //}

        //[EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        //Feedback IInventoryService.EndUndoDeleteAccount(IAsyncResult result)
        //{
        //    return Channel.EndUndoDeleteAccount(result);
        //}

        //private IAsyncResult OnBeginUndoDeleteAccount(object[] inValues, AsyncCallback callback, object asyncState)
        //{
        //    int objID = (int)inValues[0];

        //    return ((IInventoryService)(this)).BeginUndoDeleteAccount(objID, callback, asyncState);
        //}

        //private object[] OnEndUndoDeleteAccount(IAsyncResult result)
        //{
        //    Feedback retVal = ((IInventoryService)(this)).EndUndoDeleteAccount(result);
        //    return new object[] { retVal };
        //}

        //private void OnUndoDeleteAccountCompleted(object state)
        //{
        //    if ((UndoDeleteAccountCompleted != null))
        //    {
        //        InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
        //        UndoDeleteAccountCompleted(this, new FeedbackCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
        //    }
        //}

        //public void UndoDeleteAccountAsync(int objID)
        //{
        //    UndoDeleteAccountAsync(objID, null);
        //}

        //public void UndoDeleteAccountAsync(int objID, object userState)
        //{
        //    if ((onBeginUndoDeleteAccountDelegate == null))
        //    {
        //        onBeginUndoDeleteAccountDelegate = new BeginOperationDelegate(OnBeginUndoDeleteAccount);
        //    }
        //    if ((onEndUndoDeleteAccountDelegate == null))
        //    {
        //        onEndUndoDeleteAccountDelegate = new EndOperationDelegate(OnEndUndoDeleteAccount);
        //    }
        //    if ((onUndoDeleteAccountCompletedDelegate == null))
        //    {
        //        onUndoDeleteAccountCompletedDelegate = new SendOrPostCallback(OnUndoDeleteAccountCompleted);
        //    }
        //    InvokeAsync(onBeginUndoDeleteAccountDelegate, new object[] {
        //            objID}, onEndUndoDeleteAccountDelegate, onUndoDeleteAccountCompletedDelegate, userState);
        //}

        //private BeginOperationDelegate onBeginUndoDeleteAccountDelegate;

        //private EndOperationDelegate onEndUndoDeleteAccountDelegate;

        //private SendOrPostCallback onUndoDeleteAccountCompletedDelegate;

        //private partial class InventoryServiceClientChannel
        //{
        //    public IAsyncResult BeginUndoDeleteAccount(int objID, AsyncCallback callback, object asyncState)
        //    {
        //        object[] _args = new object[1];
        //        _args[0] = objID;

        //        IAsyncResult _result = BeginInvoke("UndoDeleteAccount", _args, callback, asyncState);
        //        return _result;
        //    }

        //    public Feedback EndUndoDeleteAccount(IAsyncResult result)
        //    {
        //        object[] _args = new object[0];
        //        Feedback _result = ((Feedback)(EndInvoke("UndoDeleteAccount", _args, result)));
        //        return _result;
        //    }
        //}

        //#endregion

        #region Login

        public event EventHandler<SingleFeedbackCompletedEventArgs<Account>> LoginCompleted;

        [EditorBrowsable(EditorBrowsableState.Advanced)]
        IAsyncResult IInventoryService.BeginLogin(Account account, AsyncCallback callback, object asyncState)
        {
            return Channel.BeginLogin(account, callback, asyncState);
        }

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        SingleFeedback<Account> IInventoryService.EndLogin(IAsyncResult result)
        {
            return Channel.EndLogin(result);
        }

        private IAsyncResult OnBeginLogin(object[] inValues, AsyncCallback callback, object asyncState)
        {
            Account account = (Account)inValues[0];

            return ((IInventoryService)(this)).BeginLogin(account, callback, asyncState);
        }

        private object[] OnEndLogin(IAsyncResult result)
        {
            SingleFeedback<Account> retVal = ((IInventoryService)(this)).EndLogin(result);
            return new object[] { retVal };
        }

        private void OnLoginCompleted(object state)
        {
            if ((LoginCompleted != null))
            {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                LoginCompleted(this, new SingleFeedbackCompletedEventArgs<Account>(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }

        public void LoginAsync(Account account)
        {
            LoginAsync(account, null);
        }

        public void LoginAsync(Account account, object userState)
        {
            if ((onBeginLoginDelegate == null))
            {
                onBeginLoginDelegate = new BeginOperationDelegate(OnBeginLogin);
            }
            if ((onEndLoginDelegate == null))
            {
                onEndLoginDelegate = new EndOperationDelegate(OnEndLogin);
            }
            if ((onLoginCompletedDelegate == null))
            {
                onLoginCompletedDelegate = new SendOrPostCallback(OnLoginCompleted);
            }
            InvokeAsync(onBeginLoginDelegate, new object[] {
                                                               account}, onEndLoginDelegate, onLoginCompletedDelegate, userState);
        }

        private BeginOperationDelegate onBeginLoginDelegate;

        private EndOperationDelegate onEndLoginDelegate;

        private SendOrPostCallback onLoginCompletedDelegate;

        private partial class InventoryServiceClientChannel
        {
            public IAsyncResult BeginLogin(Account account, AsyncCallback callback, object asyncState)
            {
                object[] _args = new object[1];
                _args[0] = account;

                IAsyncResult _result = BeginInvoke("Login", _args, callback, asyncState);
                return _result;
            }

            public SingleFeedback<Account> EndLogin(IAsyncResult result)
            {
                object[] _args = new object[0];
                SingleFeedback<Account> _result = ((SingleFeedback<Account>)(EndInvoke("Login", _args, result)));
                return _result;
            }
        }

        #endregion

        #region CheckIfUsernameExists

        public event EventHandler<FeedbackCompletedEventArgs> CheckIfUsernameExistsCompleted;

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        IAsyncResult IInventoryService.BeginCheckIfUsernameExists(string usernameToCheck, AsyncCallback callback, object asyncState)
        {
            return Channel.BeginCheckIfUsernameExists(usernameToCheck, callback, asyncState);
        }

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        Feedback IInventoryService.EndCheckIfUsernameExists(IAsyncResult result)
        {
            return Channel.EndCheckIfUsernameExists(result);
        }

        private IAsyncResult OnBeginCheckIfUsernameExists(object[] inValues, AsyncCallback callback, object asyncState)
        {
            string usernameToCheck = (string)inValues[0];

            return ((IInventoryService)(this)).BeginCheckIfUsernameExists(usernameToCheck, callback, asyncState);
        }

        private object[] OnEndCheckIfUsernameExists(IAsyncResult result)
        {
            Feedback retVal = ((IInventoryService)(this)).EndCheckIfUsernameExists(result);
            return new object[] { retVal };
        }

        private void OnCheckIfUsernameExistsCompleted(object state)
        {
            if ((CheckIfUsernameExistsCompleted != null))
            {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                CheckIfUsernameExistsCompleted(this, new FeedbackCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }

        public void CheckIfUsernameExistsAsync(string usernameToCheck)
        {
            CheckIfUsernameExistsAsync(usernameToCheck, null);
        }

        public void CheckIfUsernameExistsAsync(string usernameToCheck, object userState)
        {
            if ((onBeginCheckIfUsernameExistsDelegate == null))
            {
                onBeginCheckIfUsernameExistsDelegate = new BeginOperationDelegate(OnBeginCheckIfUsernameExists);
            }
            if ((onEndCheckIfUsernameExistsDelegate == null))
            {
                onEndCheckIfUsernameExistsDelegate = new EndOperationDelegate(OnEndCheckIfUsernameExists);
            }
            if ((onCheckIfUsernameExistsCompletedDelegate == null))
            {
                onCheckIfUsernameExistsCompletedDelegate = new SendOrPostCallback(OnCheckIfUsernameExistsCompleted);
            }
            InvokeAsync(onBeginCheckIfUsernameExistsDelegate, new object[] {
                    usernameToCheck}, onEndCheckIfUsernameExistsDelegate, onCheckIfUsernameExistsCompletedDelegate, userState);
        }

        private BeginOperationDelegate onBeginCheckIfUsernameExistsDelegate;

        private EndOperationDelegate onEndCheckIfUsernameExistsDelegate;

        private SendOrPostCallback onCheckIfUsernameExistsCompletedDelegate;

        private partial class InventoryServiceClientChannel
        {
            public IAsyncResult BeginCheckIfUsernameExists(string usernameToCheck, AsyncCallback callback, object asyncState)
            {
                object[] _args = new object[1];
                _args[0] = usernameToCheck;

                IAsyncResult _result = BeginInvoke("CheckIfUsernameExists", _args, callback, asyncState);
                return _result;
            }

            public Feedback EndCheckIfUsernameExists(IAsyncResult result)
            {
                object[] _args = new object[0];
                Feedback _result = ((Feedback)(EndInvoke("CheckIfUsernameExists", _args, result)));
                return _result;
            }
        }

        #endregion

        #region ResetPassword

        public event EventHandler<FeedbackCompletedEventArgs> ResetPasswordCompleted;

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        IAsyncResult IInventoryService.BeginResetPassword(Account account, AsyncCallback callback, object asyncState)
        {
            
            return Channel.BeginResetPassword(account, callback, asyncState);
        }

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        Feedback IInventoryService.EndResetPassword(IAsyncResult result)
        {
            return Channel.EndResetPassword(result);
        }

        private IAsyncResult OnBeginResetPassword(object[] inValues, AsyncCallback callback, object asyncState)
        {
            Account account = (Account)inValues[0];

            return ((IInventoryService)(this)).BeginResetPassword(account, callback, asyncState);
        }

        private object[] OnEndResetPassword(IAsyncResult result)
        {
            Feedback retVal = ((IInventoryService)(this)).EndResetPassword(result);
            return new object[] { retVal };
        }

        private void OnResetPasswordCompleted(object state)
        {
            if ((ResetPasswordCompleted != null))
            {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                ResetPasswordCompleted(this, new FeedbackCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }

        public void ResetPasswordAsync(Account account)
        {
            ResetPasswordAsync(account, null);
        }

        public void ResetPasswordAsync(Account account, object userState)
        {
            if ((onBeginResetPasswordDelegate == null))
            {
                onBeginResetPasswordDelegate = new BeginOperationDelegate(OnBeginResetPassword);
            }
            if ((onEndResetPasswordDelegate == null))
            {
                onEndResetPasswordDelegate = new EndOperationDelegate(OnEndResetPassword);
            }
            if ((onResetPasswordCompletedDelegate == null))
            {
                onResetPasswordCompletedDelegate = new SendOrPostCallback(OnResetPasswordCompleted);
            }
            InvokeAsync(onBeginResetPasswordDelegate, new object[] {
                    account}, onEndResetPasswordDelegate, onResetPasswordCompletedDelegate, userState);
        }

        private BeginOperationDelegate onBeginResetPasswordDelegate;

        private EndOperationDelegate onEndResetPasswordDelegate;

        private SendOrPostCallback onResetPasswordCompletedDelegate;

        private partial class InventoryServiceClientChannel
        {
            public IAsyncResult BeginResetPassword(Account account, AsyncCallback callback, object asyncState)
            {
                object[] _args = new object[1];
                _args[0] = account;

                IAsyncResult _result = BeginInvoke("ResetPassword", _args, callback, asyncState);
                return _result;
            }

            public Feedback EndResetPassword(IAsyncResult result)
            {
                object[] _args = new object[0];
                Feedback _result = ((Feedback)(EndInvoke("ResetPassword", _args, result)));
                return _result;
            }
        }

        #endregion

        #region ChangePassword

        public event EventHandler<FeedbackCompletedEventArgs> ChangePasswordCompleted;

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        IAsyncResult IInventoryService.BeginChangePassword(NewPasswordData account, AsyncCallback callback, object asyncState)
        {
            return Channel.BeginChangePassword(account, callback, asyncState);
        }

        [EditorBrowsableAttribute(EditorBrowsableState.Advanced)]
        Feedback IInventoryService.EndChangePassword(IAsyncResult result)
        {
            return Channel.EndChangePassword(result);
        }

        private IAsyncResult OnBeginChangePassword(object[] inValues, AsyncCallback callback, object asyncState)
        {
            NewPasswordData account = (NewPasswordData)inValues[0];

            return ((IInventoryService)(this)).BeginChangePassword(account, callback, asyncState);
        }

        private object[] OnEndChangePassword(IAsyncResult result)
        {
            Feedback retVal = ((IInventoryService)(this)).EndChangePassword(result);
            return new object[] { retVal };
        }

        private void OnChangePasswordCompleted(object state)
        {
            if ((ChangePasswordCompleted != null))
            {
                InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
                ChangePasswordCompleted(this, new FeedbackCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
            }
        }

        public void ChangePasswordAsync(NewPasswordData account)
        {
            ChangePasswordAsync(account, null);
        }

        public void ChangePasswordAsync(NewPasswordData account, object userState)
        {
            if ((onBeginChangePasswordDelegate == null))
            {
                onBeginChangePasswordDelegate = new BeginOperationDelegate(OnBeginChangePassword);
            }
            if ((onEndChangePasswordDelegate == null))
            {
                onEndChangePasswordDelegate = new EndOperationDelegate(OnEndChangePassword);
            }
            if ((onChangePasswordCompletedDelegate == null))
            {
                onChangePasswordCompletedDelegate = new SendOrPostCallback(OnChangePasswordCompleted);
            }
            InvokeAsync(onBeginChangePasswordDelegate, new object[] {
                    account}, onEndChangePasswordDelegate, onChangePasswordCompletedDelegate, userState);
        }

        private BeginOperationDelegate onBeginChangePasswordDelegate;

        private EndOperationDelegate onEndChangePasswordDelegate;

        private SendOrPostCallback onChangePasswordCompletedDelegate;

        private partial class InventoryServiceClientChannel
        {
            public IAsyncResult BeginChangePassword(NewPasswordData account, AsyncCallback callback, object asyncState)
            {
                object[] _args = new object[1];
                _args[0] = account;

                IAsyncResult _result = BeginInvoke("ChangePassword", _args, callback, asyncState);
                return _result;
            }

            public Feedback EndChangePassword(IAsyncResult result)
            {
                object[] _args = new object[0];
                Feedback _result = ((Feedback)(EndInvoke("ChangePassword", _args, result)));
                return _result;
            }
        }

        #endregion
        
    }
}